package com.zjlanyun.eplus.view.report;

import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.ViewGroup;

/**
 * 作者：韩笑 on 2017/6/15 0015 11:26
 * <p>
 * 作用：ViewPager（禁止互动的），防止与表格滑动冲突
 */


public class MyViewPage extends ViewPager {
    private ViewGroup parent;

    /**
     * 构造方法
     * @param context
     */
    public MyViewPage(Context context) {super(context);}
    public MyViewPage(Context context, AttributeSet attrs) {
        super(context, attrs);
    }
    public void setNestedpParent(ViewGroup parent) {
        this.parent = parent;
    }
    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        if (parent != null) {
            parent.requestDisallowInterceptTouchEvent(true);
        }
        return super.dispatchTouchEvent(ev);
    }
    @Override
    public boolean onInterceptTouchEvent(MotionEvent arg0) {
        return false;
    }
    @Override
    public boolean onTouchEvent(MotionEvent arg0) {
        return false;
    }

}
